<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Axios_test</title>
    <script src="./js/axios.js"></script>
</head>
<body>
    <input type="button" value="获取数据Get" onclick="get()">
    <input type="button" value="删除数据Post" onclick="Post()">
</body>
    <script>
        function get() {
            //通过axios发送异步请求
            axios({
                method: "get",
                url: "./json/1.json"
            }).then(result => {
                console.log(result.data);
            }) 

           /*  axios.get("./json/1.json").then(result =>{
                console.log(result.data);
            }) */
        }

        function post() {
            //通过axios发送异步请求
            axios({
                method: "get",
                url: "./json/1.json",
                data: "id=1"
            }).then(result => {
                console.log(result.data);
            }) 

            /* axios.post("./json/1.json").then(result => {
                console.log(result.data);
            }) */
        }
    </script>
</html>